package com.example.edu.Controller;

import com.example.edu.Dto.LoginDtoG;
import com.example.edu.Dto.RegisterDtoG;
import com.example.edu.Dto.Return;
import com.example.edu.Service.PublicService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/public")
public class PublicController {
    @Resource
    PublicService publicService;

    @PostMapping("/login")
    public Return login(@RequestBody LoginDtoG loginData){
        return publicService.login(loginData);
    }

    @PostMapping("/register")
    public Return register(@RequestBody RegisterDtoG registerData){
        return publicService.register(registerData);
    }

    @PostMapping("/init")
    public Return init(){
        return publicService.init();
    }

    @PostMapping("/test")
    public Return test(){
        return publicService.test();
    }
}
